<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:fn="http://java.sun.com/jsp/jstl/functions"
                template="/Facelets/Templates/template.xhtml">

    <ui:define name="content">	

        <script type="text/javascript">  
        function handleLoginRequest(xhr, status, args) {  
         if(args.validationFailed) {  
             jQuery('#dialog').parent().effect("shake", { times:2 }, 100);  
         } else {  
             dlgCadastro.hide();  
         }  
                }
     	
        </script>
        <div class="ui-widget" style="padding-left: 10px; padding-top: 5px; padding-bottom: 14px;">
            <a href="#{request.contextPath}/index.faces" style="color: black;">Home</a> > Devolução de Laboratórios
        </div>
        <p:fieldset legend="Devolução de Laboratórios">
            <table style="width: 100%; height: 100%;">
                <tr>
                    <td style="width: 16%; text-align: left;">
                <h:form id="formTool">
                    <p:panel>
                        <p:commandButton title="Devolver Laboratórios"
                                         value="Devolver Laboratórios" image="ui-icon ui-icon-document"
                                         oncomplete="dlgCadastro.show()" update="wizard" style="width: 160px; height: 40px;"/>
                    </p:panel>
                </h:form>
                </td>
                <td style="width: 25%;"></td>
                <td><h:graphicImage value="/imagens/messagebox.png" /></td>
                <td style="text-align: left;">
                    <p>
                        <span style="color: cornflowerblue;" class="ui-widget">Nesta seção pode ser feito uma <strong>devolução de um laboratório</strong>, edição ou exclusão.</span><br/>
                        <span style="color: cornflowerblue;" class="ui-widget">Dica 1: Para cadastrar novos clique no botão a sua esquerda.</span><br/>
                        <span style="color: cornflowerblue;" class="ui-widget">Dica 2: Para editar ou excluir visualize e os faça na tabela abaixo.</span>

                    </p>
                </td>
                <td style="width: 10%;"></td>
                </tr>
            </table>
        </p:fieldset>

        <h:form id="formTabela">
            <p:panel>
                <p:dataTable id="List" rows="10" paginator="true"
                             paginatorPosition="top"
                             var="usuario">
                    <f:facet name="header">Laboratórios a seren devolvidos</f:facet>

                    <p:column headerText="ID" style="width:10%">
                        <h:outputText value="ID"/>
                    </p:column>
                    
                    <p:column headerText="Laboratorio" style="width:20%">
                        <h:outputText value="Laboratorio"/>
                    </p:column>

                    <p:column headerText="Professor" style="width:20%">
                        <h:outputText value="Professor"/>
                    </p:column>
                    
                    <p:column headerText="Editar" style="width:10%">
                        <p:commandButton image = "ui-icon-pencil"
                                         update="formCadastro" oncomplete = "dlgCadastro.show();">

                        </p:commandButton>
                    </p:column>

                    <p:column headerText="Excluir" style="width:10%">
                        <p:commandButton update="formTabela"
                                         onclick="confirmation.show();"
                                         image="ui-icon-trash">
                        </p:commandButton>
                    </p:column>

                    <f:facet name="footer">  
            			Laboratórios a serem devolvidos no total.  
                    </f:facet>
                </p:dataTable>
            </p:panel>

        </h:form>

        <h:form>
            <p:confirmDialog message="Deseja realmente excluir esta Devolução?"
                             showEffect="slide" hideEffect="explode" appendToBody="true"
                             header="Confirmação" severity="alert" modal="true"
                             widgetVar="confirmation">

                <p:commandButton value="Sim" update="formTabela"
                                 oncomplete="confirmation.hide()"
                                 />
                <p:commandButton value="Não" onclick="confirmation.hide()"
                                 type="button" />
            </p:confirmDialog>
        </h:form>
        
        <p:dialog id = "dialog" widgetVar="dlgCadastro" resizable="false" modal="true" appendToBody="true" closeOnEscape="true"
                  position="center" width="710">
            <h:form id="formCadastro">
                <p:growl id="msgs"/>
                <p:fieldset legend="Devolução de Laboratorios">
                    <h:panelGrid columns="2" cellpadding="5">
                   
                        <h:outputText value="Laboratório*:" />
                                <h:selectOneMenu >
                                    
                                </h:selectOneMenu>
                                
                                <h:outputText value="Professor*:" />
                                <h:selectOneListbox value="#">
                            
                                </h:selectOneListbox>
                                
                                <h:outputText value="Descrição*:" />
                                <h:inputTextarea value="#{keyboardBean.value1}" style="width:450px; height:100px;"
                                                 required="true"
                                                onkeydown="this.value = this.value.toUpperCase();"
                                                onkeyup="this.value = this.value.toUpperCase()" >
                            
                                </h:inputTextarea>
                       
                    </h:panelGrid>
                    <h:panelGrid columns="3" cellpadding="5">
                        <p:commandButton value="Salvar" image = "ui-icon-save"
                                         update="formTabela msgs"  oncomplete="handleLoginRequest(xhr, status, args)"
                                         action="#{EquipamentosBean.botaoSalvarEquipamentoAction}"/>
                        <p:commandButton type="reset" value="Resetar Modificações" />
                        <p:commandButton value="Cancelar" immediate="true" onclick="dlgCadastro.hide()"/>
                    </h:panelGrid>
                </p:fieldset>
            </h:form>
        </p:dialog>

    </ui:define>
</ui:composition>